package com.shen.staservice.controller;


import com.shen.commonutils.Result;
import com.shen.staservice.client.UcenterClient;
import com.shen.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author shenkaituo
 * @since 2020-07-10
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {
    @Autowired
    private StatisticsDailyService service;

    //统计每天注册人数
    @PostMapping("registerCount/{day}")
    public Result registerCount(@PathVariable String day){
        service.registerCount(day);

        return  Result.ok().data("status","success");
    }

    // 图表的数据
    @GetMapping("showData/{type}/{begin}/{end}")
    public  Result showData(@PathVariable String type,@PathVariable String begin,
                            @PathVariable String end ){

        Map<String,Object>map =service.getShowData(type,begin,end);

        return  Result.ok().data("data",map);
    }

}

